<?php 
 session_start(); 
require_once 'backend/Trends.php';

if(isset($_SESSION['Trend']))
{
	$trend = unserialize($_SESSION['Trend']);
}

$days = $trend->getDays();
$dayTotals = $trend->getDayTotals();
$randomSeed = rand();

$totalsArray = "";
$max = 0;
for($i = 1; $i < $days; $i++)
{
	$totalsArray .= "$dayTotals[$i]" . ",";
	if($max < $dayTotals[$i])
		$max = $dayTotals[$i];
}
$totalsArray .= "$dayTotals[$days]";
$month = $trend->getMonth();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form action='https://chart.googleapis.com/chart?chid=<?php echo $randomSeed;?>&chs=600x450&chd=<?php echo $totalsArray;?>&chds=0,<?php echo $max;?>&cht=lc&chxt=x,y&chxr=0,0,<?php echo $days;?>,1|1,0,<?php echo $max;?>' method='POST'>
  	<input type="hidden" name="cht" value="lc"  />
    <input type="hidden" name="chtt" value="<?php echo $month?>'s Daily Earnings Summary"  />
    <input type='hidden' name='chs' value='600x450' />

    <input type="hidden" name="chxt" value="x,y" /><!-- DEFINES THE AXIS SHOWN -->
    <input type="hidden" name="chxr" value="0,0,<?php echo $days;?>,1|1,0,<?php echo $max;?>" />
    <input type='hidden' name='chd' value='t:<?php echo $totalsArray;?>'/>
    <input type="submit" value = "View <?php echo $month;?>'s Chart" /> 
</form>
</body>
</html>
